package com.zhiqihang.ziqihangserverteacher.controller;


import com.zhiqihang.result.JsonResult;
import com.zhiqihang.ziqihangserverteacher.pojo.DTO.TeacherQuery;
import com.zhiqihang.ziqihangserverteacher.pojo.VO.TeacherVO;
import com.zhiqihang.ziqihangserverteacher.service.TeacherService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Validated
@Slf4j
@Api(tags = "教师模块")
@RequestMapping("/v1/teacher")
@RestController
public class TeacherController {

    @Autowired
    private TeacherService teacherService;


    /**
     * 要做这个查询功能吗？
     * 这个方法是根据前端传过来的老师的名字、id来获取老师的图片地址以及介绍和信息
     * 功能：
     * 做一个动态条件查找---实现两个目标：1、搜索教师信息的功能 2、显示热门（即在教师表中职称为指定值的记录的）教师的相关信息
     *
     * @return
     */
    @GetMapping("/select")
    public JsonResult select(TeacherQuery teacherQuery) {
        log.debug("TeacherQuery{}", teacherQuery);
        List<TeacherVO> teacherVOList = teacherService.selectTeacherInfoByQuery(teacherQuery);
        return JsonResult.ok(teacherVOList);
    }

}
